using System;
using System.Collections.Generic;
using SimpleJSON;

namespace Gj
{
    public class LocalTools
    {
        public static Dictionary<string, JSONNode> data = new();

        public static JSONNode GetData(string key, Func<JSONObject> get)
        {
            if (!data.ContainsKey(key)) data[key] = get();

            return data[key];
        }

        public static JSONNode GetData(string key)
        {
            if (!data.ContainsKey(key)) return null;

            return data[key];
        }

        public static void SetData(string key, JSONNode node)
        {
            data[key] = node;
        }
    }
}